package study.cell_game.objects;

import org.andengine.engine.Engine;
import org.andengine.opengl.texture.Texture;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.TextureRegion;
import org.andengine.opengl.texture.region.TextureRegionFactory;
import org.andengine.ui.activity.BaseGameActivity;

import android.util.Log;

public class Textures {
	private BitmapTextureAtlas mTexture;
	private TextureRegion mBackgroundTextureRegion;
	private TextureRegion mFullRingTextureRegion;
	private TextureRegion mTokenGreenTextureRegion;
	private TextureRegion mFieldsTextureRegion;
	private TextureRegion mLevelGradientTextureRegion;
	
	private TextureRegion mMenuTextureRegion;
	private TextureRegion mLoadButtonTextureRegion;
	private TextureRegion mQuitButtonTextureRegion;
	private TextureRegion mNewButtonTextureRegion;
	private TextureRegion mSettingsButtonTextureRegion;
	
	
	
	
	  public Textures(final BaseGameActivity activity, final Engine engine) {
	    //create atlas
		this.mTexture = new BitmapTextureAtlas(engine.getTextureManager(), 2048, 2048,
	        TextureOptions.BILINEAR_PREMULTIPLYALPHA);
	    
	    //add textures to it
	    this.mBackgroundTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
	        this.mTexture, activity, "gfx/background.png", 0, 0);
	    this.mFullRingTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		        this.mTexture, activity, "gfx/OuterRings/FullRing.png", 1024, 0);
	    this.mTokenGreenTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
	    		this.mTexture, activity, "gfx/BackgroundColors/TokenGreen.png", 1024, 68);
	    this.mFieldsTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
	    		this.mTexture, activity, "gfx/FieldsGlow.png", 1104, 0);
	    this.mLevelGradientTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		        this.mTexture, activity, "gfx/LevelRedBlueGradient.png", 0, 720);
	    
	    //this.mMenuTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		//        this.mTexture, activity, "gfx/Menu/MainMenuLayout.png", 0, 720);
	    //this.mLoadButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		//        this.mTexture, activity, "gfx/Menu/LoadCoreToken.png", 1024, 0);
	    //this.mQuitButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		//        this.mTexture, activity, "gfx/Menu/CloseGameCoreToken.png", 1024, 0);
	    //this.mNewButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		//        this.mTexture, activity, "gfx/Menu/NewGameCoreToken.png", 1024, 0);
	    //this.mSettingsButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		//        this.mTexture, activity, "gfx/Menu/SettingsCoreToken.png", 1024, 0);
	    
	    
	    
	    engine.getTextureManager().loadTexture(this.mTexture);
	  }
	  
	  public TextureRegion getBackground(){
	    return mBackgroundTextureRegion;
	  }
	  
	  public TextureRegion getFullRing(){
		  return mFullRingTextureRegion;
	  }
	  
	  public TextureRegion getFields()
	  {
		  return mFieldsTextureRegion;
	  }
	  
	  public TextureRegion getGreen()
	  {
		  return mTokenGreenTextureRegion;
	  }
	  
	  public TextureRegion getGradient()
	  {
		  return mLevelGradientTextureRegion;
	  }

	public TextureRegion getmMenuTextureRegion() {
		return mMenuTextureRegion;
	}

	public void setmMenuTextureRegion(TextureRegion mMenuTextureRegion) {
		this.mMenuTextureRegion = mMenuTextureRegion;
	}

	public TextureRegion getmLoadButtonTextureRegion() {
		return mLoadButtonTextureRegion;
	}

	public void setmLoadButtonTextureRegion(TextureRegion mLoadButtonTextureRegion) {
		this.mLoadButtonTextureRegion = mLoadButtonTextureRegion;
	}

	public TextureRegion getmQuitButtonTextureRegion() {
		return mQuitButtonTextureRegion;
	}

	public void setmQuitButtonTextureRegion(TextureRegion mQuitButtonTextureRegion) {
		this.mQuitButtonTextureRegion = mQuitButtonTextureRegion;
	}

	public TextureRegion getmNewButtonTextureRegion() {
		return mNewButtonTextureRegion;
	}

	public void setmNewButtonTextureRegion(TextureRegion mNewButtonTextureRegion) {
		this.mNewButtonTextureRegion = mNewButtonTextureRegion;
	}

	public TextureRegion getmSettingsButtonTextureRegion() {
		return mSettingsButtonTextureRegion;
	}

	public void setmSettingsButtonTextureRegion(TextureRegion mSettingsButtonTextureRegion) {
		this.mSettingsButtonTextureRegion = mSettingsButtonTextureRegion;
	}
	  
	  
}
